package action;

import com.opensymphony.xwork2.ActionSupport;

public class I18NAction extends ActionSupport {

	private static final long serialVersionUID = 5493126930784590086L;
	private String userName;

	@Override
	public String execute() throws Exception {
		if ("admin".equals(userName)) {
			addActionMessage(getText("welcome",new String[]{userName}));
			return SUCCESS;
		} else {
			addFieldError("userName", getText("failure"));
			return INPUT;
		}

	}

	/**
	 * 获取 userName
	 * 
	 * @return userName
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * 设置 userName
	 * 
	 * @param userName
	 *            userName
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

}
